package Desort;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class SecondIndexMapper extends Mapper<LongWritable,Text,Text,Text> {
    Text k  = new Text();
    Text v  = new Text();
    @Override
    protected void map(LongWritable key,Text value, Context context) throws IOException, InterruptedException {
        //k,v : Tom_255,c.txt	3
       //获取行数据Tom_255--c.txt	3
        String line = value.toString();
        //切分数据
        String[] split = line.split("--");
        //封装数据
        k.set(split[0]);
        v.set(split[1]);
        //写出数据
        context.write(k,v);



    }
}
